<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <!-- 引入vue2的js文件 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.9/vue.js"></script>
    <script src="https://unpkg.com/dayjs@1.8.21/dayjs.min.js"></script>
</head>

<body>
    <div id="app">
        <p>{{timeOne | formTime}}</p>
    </div>

    <script>
        new Vue({
            el: '#app',
            data: {
                timeOne: new Date()
            },
            filters: {
                formTime(val) {
                    return dayjs(val).format('YYYY-MM-DD HH:mm:ss',)
                }
            },
            created() {
                setTimeout(() => {
                    this.timeOne = new Date()
                }, 1000);
            }
        })
    </script>
</body>

</html>